package com.mall.goods.service.impl;

import com.mall.common.utils.DateUtils;
import com.mall.goods.mapper.GoodsCollectMapper;
import com.mall.goods.model.dto.GoodsCollectDto;
import com.mall.goods.model.vo.GoodsCollectVo;
import com.mall.goods.service.IGoodsCollectService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 商品收藏Service业务层处理
 */
@Service
public class GoodsCollectServiceImpl implements IGoodsCollectService
{
    @Resource
    private GoodsCollectMapper goodsCollectMapper;

    /**
     * 查询商品收藏
     */
    @Override
    public GoodsCollectVo selectGoodsCollectById(Long id)
    {
        return goodsCollectMapper.selectGoodsCollectById(id);
    }

    /**
     * 查询商品收藏列表
     */
    @Override
    public List<GoodsCollectVo> selectGoodsCollectList(GoodsCollectDto goodsCollectDto)
    {
        return goodsCollectMapper.selectGoodsCollectList(goodsCollectDto);
    }

    /**
     * 新增商品收藏
     */
    @Override
    public int insertGoodsCollect(GoodsCollectDto goodsCollectDto)
    {
        goodsCollectDto.setCreateTime(DateUtils.getNowDate());
        return goodsCollectMapper.insertGoodsCollect(goodsCollectDto);
    }

    /**
     * 修改商品收藏
     */
    @Override
    public int updateGoodsCollect(GoodsCollectDto goodsCollectDto)
    {
        return goodsCollectMapper.updateGoodsCollect(goodsCollectDto);
    }

    /**
     * 批量删除商品收藏
     */
    @Override
    public int deleteGoodsCollectByIds(Long[] ids)
    {
        return goodsCollectMapper.deleteGoodsCollectByIds(ids);
    }

    /**
     * 删除商品收藏信息
     */
    @Override
    public int deleteGoodsCollectById(Long id)
    {
        return goodsCollectMapper.deleteGoodsCollectById(id);
    }
}
